package tr.com.softoval.beanscanner.generator;

import java.util.List;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.context.ResourceLoaderAware;
import org.springframework.core.io.ResourceLoader;

import tr.com.softoval.beanscanner.util.Constants;

public class BeanCandidateScanner implements ResourceLoaderAware, BeanFactoryPostProcessor {
	private BeanDefinitionGenerator generator = BeanDefinitionGenerator.getInstance();
	
	public void postProcessBeanFactory(ConfigurableListableBeanFactory factory) throws BeansException {
		this.generator.setBeanFactory(factory);
	}
	
	public void setResourceLoader(ResourceLoader resourceLoader) {
		this.generator.setResourceLoader(resourceLoader);
	}
	
	public void setBaseLocations(List<String> list) {
		this.generator.setGeneratorProperty(Constants.BASE_LOCATION, list);
	}
	
	public void setAbstractLiterals(List<String> abstractClassLiterals) {
		this.generator.setGeneratorProperty(Constants.ABSTRACT_DEFINITION, abstractClassLiterals);
	}
	
	public void setInterfaceLiterals(List<String> interfaceLiterals) {
		this.generator.setGeneratorProperty(Constants.INTERFACE_DEFINITION, interfaceLiterals);
	}
	
	public void setAnnotationLiterals(List<String> annotationLiterals) {
		this.generator.setGeneratorProperty(Constants.ANNOTATION_DEFINITION, annotationLiterals);
	}
	
	public void setClasspathSearchPatterns(List<String> searchPatterns) {
		this.generator.setGeneratorProperty(Constants.SEARCH_PATTERN, searchPatterns);
	}

}
